package com.train.member.req;

import com.train.common.group.AddGroup;
import com.train.common.group.EditGroup;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class PassengerAddOrEditReq {

    @NotNull(message = "id不能为空", groups = {EditGroup.class})
    private Long id;

    /**
     * 姓名
     */
    @NotBlank(message = "姓名不能为空", groups = {EditGroup.class, AddGroup.class})
    @Size(max = 20, message = "姓名太长", groups = {EditGroup.class, AddGroup.class})
    private String name;

    /**
     * 身份证
     */
    @NotBlank(message = "身份证不能为空", groups = {EditGroup.class, AddGroup.class})
    @Pattern(regexp = "^[1-9]\\d{5}(?:19|20)\\d\\d(?:0[1-9]|1[012])(?:0[1-9]|[12]\\d|3[01])\\d{3}(?:\\d|X|x)$",
            message = "身份证格式不正确",
            groups = {EditGroup.class, AddGroup.class})
    private String idCard;

    /**
     * 旅客类型|枚举[PassengerTypeEnum]
     */
    @NotNull(message = "旅客类型不能为空", groups = {EditGroup.class, AddGroup.class})
    private Integer type;
}
